﻿using GuanQL.Core.Domain.Accounts;
using GuanQL.Core.Stores;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using System;

namespace GuanQL.DataMigration.Seeds
{
    public class TenantSeed : BaseSeed
    {
        private readonly UserManager<User> _userManager;

        public TenantSeed(
                UserManager<User> userManager,
                GQLDbContext dbContext) : base(dbContext)
        {
            _userManager = userManager;
        }

        public override async Task Seed()
        {
            await _dbContext.Set<Tenant>().AddRangeAsync(AddTenant());

            await _dbContext.SaveChangesAsync();
        }

        private List<Tenant> AddTenant()
        {
            var tenantList = new List<Tenant>();

            tenantList.Add(new Tenant
            {
                TenantId = TenantId,
                Name = "光影传媒",
                Host = "www.guangyingchuanmei.com",
                OrgName = "光影",
                SMSSignName = "光影",
                Description = "光影小区助手",
            });

            tenantList.Add(new Tenant
            {
                TenantId = Guid.NewGuid(),
                Name = "极客维修",
                Host = "www.jikeweixiu.com",
                OrgName = "极客",
                SMSSignName = "极客",
                Description = "极客小区助手",
            });
            tenantList.Add(new Tenant
            {
                TenantId = Guid.NewGuid(),
                Name = "迅影快修",
                Host = "www.xunyingkuaixiu.com",
                OrgName = "迅影",
                SMSSignName = "迅影",
                Description = "迅影小区助手",
            });
            return  tenantList;
        }
    }
}
